#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
using namespace std;
int num[1000] = { 6,2,5,5,4,5,6,3,7,6};
int path[10];
int n, cnt = 0;
int calfire(int i)
{
	if (num[i])return num[i];//如果对应火柴棒数量已经存在,直接返回
	else
{
	int fire = 0;
	int index = i;
	while (i)
	{
		fire += num[i % 10];
		i /= 10;
	}
	num[index] = fire;
	return fire;
}
}
void dfs(int depth,int sum)
{
	if (sum > n)return;
	if(depth>3)
	{
		if (sum == n && path[1] + path[2] == path[3])
		{
			cnt++;
		}
		return;
	}
	for (int i = 0; i <= 1000; i++)
	{
		path[depth] = i;
		dfs(depth + 1, sum + calfire(i));
	}
}
int main()
{
	scanf("%d", &n);	
	dfs(1,4);
	printf("%d",cnt);
	return 0;
}


